home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Yerk 3.64 / Supplement / Unsupported / Optionals / 2dArray < prev    next >
Text File  |  1986-01-22  |  946b  |  48 lines

  1.  \ 2 Dimensional Array
  2. \  3/01/85  rw
  3. \  1/07/86  cdn Added print: method
  4.  
  5. :CLASS    2dArray     <Super Array  4 <Indexed
  6.  
  7.     Int     xbound
  8.  
  9.     \ ( xbound -- )  Store x bound; y bound already used by super Array
  10.     :M  CLASSINIT:  put: xbound ;M
  11.  
  12.     \ ( -- )  Allocate arrays for second dimension
  13.     :M  NEW:
  14.         limit: super 0
  15.         DO
  16.                   get: xbound heap> array i to: super
  17.         LOOP
  18.     ;M
  19.  
  20.     \ ( val x y -- )
  21.     :M  TO: to: [ at: super ] ;M
  22.  
  23.     \ ( x y -- )
  24.     :M  AT: at: [ at: super ] ;M
  25.  
  26.     \ ( -- )  Deallocate array space in heap
  27.     :M  DISPOSE:
  28.         limit: super 0
  29.         DO
  30.             i at: super killptr
  31.         LOOP
  32.     ;M
  33.  
  34.     :M  XLIMIT: get: xbound ;M
  35.  
  36.     :M  YLIMIT: limit: super ;M
  37.  
  38.     :M  PRINT:  ylimit: self 0
  39.                 DO  CR
  40.                     xlimit: self 0
  41.                     DO
  42.                         i j at: self .
  43.                     LOOP
  44.                 LOOP
  45.     ;M
  46.  
  47. ;CLASS
  48.